/*
* @Author: Administrator
* @Date:   2017-11-03 15:38:09
* @Last Modified by:   Administrator
* @Last Modified time: 2017-11-15 13:48:27
*/
 
 $(function(){

    $(".footer").load("layout/footer.html");
    $(".header2").load("layout/header2.html");

 var bannerHtml=$('#banner').html();
 var ad1Html=$('#ad1').html();
 var renzhengHtml=$('#renzheng').html();
 var ad2Html=$('#ad2').html();
 var baopinHtml=$('#baopin').html();

  // 轮播图
    $(function() {
              $.ajax({
                       type:"get",
                       url:"data/ziyingmall.json",
                       async:true,
                       success: function(data){
                        console.log(data);
                        var banner=data.banner;
                        var renzheng=data.renzheng;
                        var ad1=data.ad1;
                        var ad2=data.ad2;
                        var baopin=data.baopin;
                        // banner
                          $('.banner').html(doT.template(bannerHtml)(banner));
                              var swiper = new Swiper('.swiper-container', {
                                  pagination: '.swiper-pagination',
                                  nextButton: '.swiper-button-next',
                                  prevButton: '.swiper-button-prev',
                                  paginationClickable: true,
                                  spaceBetween: 30,
                                  centeredSlides: true,
                                  autoplay: 2500,
                                  autoplayDisableOnInteraction: false
                              });
                        // 推荐
                        $('.renzheng').html(doT.template(renzhengHtml)(renzheng));
                        $('.ad1').html(doT.template(ad1Html)(ad1));
                        $('.ad2').html(doT.template(ad2Html)(ad2));
                        $('.baopin').html(doT.template(baopinHtml)(baopin));
                       },
                       error: function(XMLHTTPRequest, textStatus, errorThrown){
                         console.log("XMLHttpRequest :"+ XMLHTTPRequest);
                         console.log("textStatus :"+textStatus);
                         console.log("errorThrown :"+errorThrown);
                       }
                     });
                
    });

    
    
})
